package service

import (
	"gitee.com/Yu-eng/Myproject/my-go-blog/config"
	"gitee.com/Yu-eng/Myproject/my-go-blog/dao"
	"gitee.com/Yu-eng/Myproject/my-go-blog/models"
)

func GetPostDetail(pid int) (*models.PostRes, error) {
	post, err := dao.GetPostById(pid)
	if err != nil {
		return nil, err
	}
	var postMore models.PostMore

	postRes := &models.PostRes{
		Viewer:       config.Cfg.Viewer,
		SystemConfig: config.Cfg.System,
		Article:      postMore,
	}
	return postRes, nil
}
